<form class="form-inline">
    <label class="control-label">有效期:</label>

    <input id="expirationDate" class="datepicker" type="text" required>
    <label class="control-label">数量:</label>

    <input id="length" type="text" ng-model="length" required>

    <button type="submit" class="btn btn-xs btn-secondary" ng-click="generateCode(length)">生成推广码</button>
</form>

<br>
<form class="form-inline">
    <label class="control-label">创建时间:</label>

    <select ng-model="input.dateCreated" ng-options="m as m | date:'yyyy-MM-dd HH:mm:ss' for m in dateList">
        <option value="">-- 请选择 --</option>
    </select>
    <label class="control-label">有效期:</label>

    <select ng-model="input.expirationDate"
            ng-options="m as m | date:'yyyy-MM-dd HH:mm:ss' for m in expirationDateList">
        <option value="">-- 请选择 --</option>
    </select>
    <label class="control-label">拥有者:</label>

    <input type="text" ng-model="input.owner">

    <button type="submit" class="btn btn-xs btn-secondary" ng-click="searchCode(input)">搜索</button>
</form>

<br>
<div class="tab-content">
    <div class="tab-pane active" id="tab_a">
        <table class="table table-condensed">
            <thead>
            <tr>
                <th>推广码</th>
                <th>有效期</th>
                <th>创建时间</th>
                <th>拥有者</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="code in codes">

                <td>{{code.code}}</td>
                <td>{{code.expirationDate | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{code.dateCreated | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{code.owner}}</td>
                <td><a ng-click="setOwner(code.objId)" class="btn btn-primary btn-xs">设置拥有者</a></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>